#include <iostream>
#include <cmath>
using namespace std;
class Decimal{
private:
  int data;
  int base;
  int weishu;
  int Seq[100];
public:
  Decimal(int _data,int _base){
    data=_data;
    base=_base;
    for(int i=0;i<100;i++){
    	Seq[i]=0;
	}
	weishu=0;
  }
  void SetSequence();
  void Judge();
  void PrintSequence();
};
void Decimal::SetSequence(){
  int nowdata=data;
  while(nowdata){
    Seq[weishu]=nowdata%base;
    nowdata=(nowdata-nowdata%base)/base;
    weishu++;
  }
}
void Decimal::Judge(){
  int i,j;
  i=0;
  j=weishu-1;
  int flag=1;
  while(i<weishu&&j>=0){
    if(Seq[i]!=Seq[j]){
      flag=0;
      break;
    }
    i++;
    j--;
  }
  if(flag==0){
  	cout<<"No"<<endl;
  }
  else{
  	cout<<"Yes"<<endl;
  }
}
void Decimal::PrintSequence(){
  for(int i=weishu-1;i>0;i--){
  	cout<<Seq[i]<<" ";
  }
  cout<<Seq[0]<<endl;
}
int main(){
  long int data;
  long int base;
  cin>>data>>base;
  Decimal D(data,base);
  D.SetSequence();
  D.Judge();
  D.PrintSequence();
}
